<template>
  <div>
      请输入用户名：<input type="text" v-model="username"><br>
      请输入密码：<input type="password" v-model="password"><br>
      <Button @click="submit">登录</Button>
  </div>
</template>

<script>
export default {
    data() {
        return {
            username:'',
            password:'',
        }
    },
    //注册组件标签
    components:{

    },
    // 钩子函数
    mounted:function(){

    },
    methods:{
        submit() {
            this.axios.get('http://127.0.0.1:8000/login/',{params: {'username':this.username,'password':this.password}}).then((result)=>{
                if (result.data.code == 403){
                    this.$message(result.data.msg);
                    return false;
                }
                else{
                    this.$message(result.data.msg);
                    this.$router.push('/');
                }
            })
        },
    }


}
</script>

<style>

</style>